package com.tasly.attendance.entity;

import java.util.Date;

public class AttendanceRecordEntity implements Comparable<AttendanceRecordEntity> {

    private String userId;
    private Date workingTime;
    
    public String getUserId() {
        return userId;
    }
    public void setUserId(String userId) {
        this.userId = userId;
    }
    public Date getWorkingTime() {
        return workingTime;
    }
    public void setWorkingTime(Date workingTime) {
        this.workingTime = workingTime;
    }
    
    @Override
    public int compareTo(AttendanceRecordEntity o) {
        if (o.getWorkingTime().before(workingTime)) {
            return 1;
        } else if (o.getWorkingTime().after(workingTime)) {
            return -1;
        }
        return 0;
    }
    
    @Override
    public String toString() {
        StringBuffer sb = new StringBuffer();
        sb.append("userId: ").append(userId).append("   workingTime: ").append(workingTime);
        return sb.toString();
    }
    
}
